<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>区域管理</title>
	<%@include file="/WEB-INF/views/include/head.jsp" %>
	<script type="text/javascript">
		$(document).ready(function() {
			var height=$(window).height()-70;
			$('#myAreaForm').height(height)
			$("#inputForm").validate({
				submitHandler: function(form){
					layer.msg('正在提交，请稍等...',{icon:16});
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$(element).closest( "form" )
					.find( "span[for='" + element.attr( "name" ) + "']" ).html(error);
					var type=$(element).attr('type');
					if(type=='checkbox'||type=='radio'||type=='select')$(error).text("必选项");
				}
			});
		});
	</script>
</head>
<body style="overflow: hidden;">
	<ul class="nav nav-tabs">
		<li><a href="${ctxAdmin}/sys/area/">区域列表</a></li>
		<li class="active"><a href="form?id=${area.id}&parent.id=${area.parent.id}"><shiro:hasPermission name="sys:area:edit">${not empty area.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:area:edit">查看</shiro:lacksPermission>区域信息</a></li>
	</ul><br/>
	<div id="myAreaForm" style="overflow-y: auto;overflow-x:hidden">
	<form:form id="inputForm" modelAttribute="area" action="${ctxAdmin}/sys/area/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="form-group">
			<label class="col-sm-3 control-label">上级区域:</label>
			<div class="col-sm-5">
				<sys:treeselect id="area" name="parent.id" value="${area.parent.id}" labelName="parent.name" labelValue="${area.parent.name}"
					title="区域" url="/sys/area/treeData" extId="${area.id}"  allowClear="true"/><!-- cssClass="required" -->
			</div>
			<div class="col-sm-2">
				<span for="parent.name"></span>
				<!-- <font color="red">*</font> -->
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">区域名称:</label>
			<div class="col-sm-5">
				<form:input path="name" htmlEscape="false" maxlength="50" class="required form-control"/>
			</div>
			<div class="col-sm-2">
				<span for="name"></span>
				<font color="red">*</font>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">区域编码:</label>
			<div class="col-sm-5">
				<form:input path="code" htmlEscape="false" maxlength="50" cssClass="form-control"/>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">区域类型:</label>
			<div class="col-sm-5">
				<form:select path="type" cssStyle="width:150px" class="form-control m-b">
					<form:options items="${typeList}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">区划备注:</label>
			<div class="col-sm-5">
			
				<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="form-control"/>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-5 col-sm-offset-3">
				<shiro:hasPermission name="sys:area:edit"><input id="btnSubmit" class="btn btn-success btn-sm" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
				<input id="btnCancel" class="btn btn-sm" type="button" value="返 回" onclick="history.go(-1)"/>
			</div>
		</div>
	</form:form>
	</div>
</body>
</html>